<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <link th:href="@{/styles/resume.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/styles/comapply.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/styles/css.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/styles/tips.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/js/jquery-3.7.1.min.js}"></script>
    <script th:src="@{/js/http.js}"></script>
    <title>简历详情</title>
</head>

<script>
    const industryMappings = {
        "0" : "不限",
        "1" : "计算机/互联网",
        "2" : "销售/客服/技术支持",
        "3" : "会计/金融/银行/保险",
        "4" : "生产/营运/采购/物流",
        "5" : "生物/制药/医疗/护理",
        "6" : "广告/市场/媒体/艺术",
        "7" : "建筑/房地产",
        "8" : "人事/行政/高级管理",
        "9" : "咨询/法律/教育/科研",
        "10" : "服务业",
        "11" : "公务员/翻译/其他",
        "12" : "化工/能源",
        "13" : "贸易/百货",
        "14" : "机械/设备/技工",
        "15" : "通信/电子",
    }
    const hunterStatusMappings = {
        "0": "已离职，寻求新工作",
        "1": "在职，考虑更好工作",
        "2": "其他",
    }
    const genderMappings = {
        "1": "男",
        "2": "女",
    }
    const highestDegree = {
        "1": "高中以下",
        "2": "高中",
        "3": "中专",
        "4": "大专",
        "5": "本科",
        "6": "硕士",
        "7": "博士"
    }
    const resumeId = sessionStorage.getItem('resumeId')
    let resume = {}
    let workExps = []
    let eduBgs = []
    $(function(){
        getResumeById()
        // 使用 URLSearchParams 解析当前 URL 的参数
        console.log(resumeId);
    })
    function getResumeById(){
        httpJsonRequest(
          "/resume/viewResume",
          "POST",
          resumeId,
          localStorage.getItem("token"),
          "application/json",
          function (res) {
            console.log(res);
            processData(res.data)
              renderResume(res.data.resume)
              res.data.workExps.forEach(function(workExp){
                  addWorkExp(workExp)
              })
              res.data.eduBgs.forEach(function(eduBg){
                  addEduBg(eduBg)
              })
          }
        );
    }
    function renderResume(){
        let gender = genderMappings[resume.gender]
        $('#username').text(resume.name)
        $('#gender').before(gender)
        let birthdate = resume.birthdate ? new Date().getFullYear() - new Date(resume.birthdate).getFullYear() : "未知"
        $('#age').before(birthdate+'岁')
        $('#workDuration').before(resume.workDuration+'年工作经验')
        let degree = highestDegree[resume.highestDegree]
        $('#highestDegree').before(degree)
        $('#highestDegree').after(resume.residence)
        $('#intent').after(resume.intent)
        let industry = industryMappings[resume.industry]
        $('#industry').after(industry)
        let wage = resume.minWage+'千元-'+ resume.maxWage+'千元'
        $('#wage').after(wage)
        $('#arriveDate').after(resume.arriveDate)
        let hunterStatus = hunterStatusMappings[resume.hunterStatus]
        $('#hunterStatus').after(hunterStatus)
        $('#telphone').text(resume.telphone)
        console.log(resume.refreshTime)
        let refreshDate = resume.refreshTime.split('T')[0]
        $('#refreshTime').text('更新：'+refreshDate)
        $('#viewNum').text('浏览次数：'+resume.viewNum)

    }
    function addWorkExp(workExp){
        $('#workExps').append(function() {
            var html = ''
            html += `<li><i class="yun_newedition_icon"></i>`
            html += `<div class="yun_newedition_jobname">${workExp.entName}<span`
            html += `class="yun_newedition_job_zw">担任职位：${workExp.position}</span></div>`
            html += `<div class="">工作时间：${workExp.hireDate} - ${workExp.leaveDate} <span style="color: red;">【4年2个月】</span></div>`
            html += `</li>`
            return html
        })
    }

    function addEduBg(eduBg){
        $('#eduBgs').append(function() {
            var html = ''
            html += `<li>`
            html +=    `<i class="yun_newedition_icon"></i>`
            html +=    `<div class="yun_newedition_jobname">${eduBg.school}<span`
            html +=     `class="yun_newedition_job_zw">学历学位：${eduBg.highestDegree}</span>`
            html +=    `</div>`
            html +=    `<div class="">在校时间：${eduBg.startDate}至${eduBg.graduateDate}</div>`
            html += `</li>`
            return html
        })
    }
    function processData(data) {
        resume = {}
        workExps = []
        eduBgs = []
        resume = data.resume
        workExps = data.workExps
        eduBgs = data.eduBgs
    }
</script>
<body style="background:#fff;">
<div class="noprint">
    <div class="hp_head hp_head_box">
        <div class="w1200">
        <div class="hp_head_ft fl">
                <div class="phpyun_logo fl">
                    <a th:href="@{/}" title="人才招聘系统最新招聘求职信息">
                        <img th:src="@{/images/logo.png}" alt="人才招聘系统"/>
                    </a>
                </div>
            </div>
            <div class="yun_header_nav_box">
                <ul>
                    <li class="">
                        <a href="" class="png"> 首页 </a>
                        <i class="yun_new_headernav_list_line"></i>
                    </li>
                    <li class="">
                        <a href="" class="png"> 找工作 </a>
                        <i class="yun_new_headernav_list_line"></i>
                    </li>
                    <li class="">
                        <a href="" class="png"> 找人才 </a>
                        <i class="yun_new_headernav_list_line"></i>
                    </li>
                    <li class="">
                        <a href="" class="png"> 找企业 </a>
                        <i class="yun_new_headernav_list_line"></i>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="clear"></div>
<div class="yun_newedition_resume_top">
    <div class="w1200" style="">
        <div class="yun_newedition_resume_current"> 首页 > 找人才 > 简历详细</div>
        <div class="yun_newedition_resume_info" style="">
            <div class="yun_newedition_resume_info_c">
                <div class="yun_newedition_resume_info_pic">
                    <img src="" width="140" height="140"/>
                    <i class="resume_list_xb resume_list_xb "></i>
                </div>
                <div>
        				<span class="yun_newedition_resume_username" id="username">
        				</span>
                </div>
                <div class="yun_newedition_resume_basic">
                    <span class="yun_newedition_resume_line" id="gender">|</span>
                    <span class="yun_newedition_resume_line" id="age">|</span>  <span
                        class="yun_newedition_resume_line" id="workDuration">|</span>
                    <span class="yun_newedition_resume_line" id="highestDegree">|</span>
                </div>
                <div class="yun_newedition_resume_data">
                    <span class="yun_newedition_resume_data_time" id="refreshTime"></span>
                    <span id="viewNum"></span>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="w1200" style="">
    <div class="yun_newedition_resume_cont" style="">
        <div class="yun_newedition_resume_left" style="">
            <div class="yun_newedition_tit"><span class="yun_newedition_tit_s">求职意向</span><i
                    class="yun_newedition_tit_line"></i></div>
            <div class="">
                <ul class="yun_newedition_yx_list">
<!--                    <li style="width:100%">-->
<!--                        <span class="yun_newedition_yx_name"> 工作职能：</span>-->
<!--                        <span class="yun_newedition_yx_job" >todo:查职位表</span>-->
<!--                    </li>-->
                    <li><span class="yun_newedition_yx_name" id="intent"> 意向岗位：</span></li>
                    <li><span class="yun_newedition_yx_name" id="industry"> 从事行业：</span></li>
                    <li><span class="yun_newedition_yx_name" id="wage"> 期望薪资：</span></li>
                    <li><span class="yun_newedition_yx_name" id="arriveDate"> 到岗时间：</span></li>
                    <li><span class="yun_newedition_yx_name" id="hunterStatus"> 求职状态：</span></li>
                    <li><span class="yun_newedition_yx_name"> 工作性质：</span>全职</li>
                    <li style="width:100%"><span class="yun_newedition_yx_name"> 工作地点：</span> 成都&nbsp;</li>
                </ul>
            </div>

            <div class="yun_newedition_exhibition">
                <div class="yun_newedition_tit">
                    <span class="yun_newedition_tit_s">联系方式</span>
                    <i class="yun_newedition_tit_line"></i>
                </div>
                <div class="tcktouch_box_tip">联系我时请说是在千里马人才招聘系统上看到的</div>
                <div class="tcktouch_box_p">手机：<span class="tcktouch_box_p_sj" id="telphone"></span></div>
            </div>
            <!--工作经历-->
            <div class="yun_newedition_exhibition">
                <div class="yun_newedition_tit">
                    <span class="yun_newedition_tit_s">工作经历</span>
                    <i class="yun_newedition_tit_line"></i>
<!--                    <span class="yun_resume_jobtime" style="margin-left:20px;">平均工作时长：4年2个月</span>-->
                </div>
                <ul class="yun_newedition_joblist" id="workExps">
                </ul>
            </div>
            <!--教育经历-->
            <div class="yun_newedition_exhibition">
                <div class="yun_newedition_tit">
                    <span class="yun_newedition_tit_s">教育经历</span>
                    <i class="yun_newedition_tit_line"></i>
                </div>
                <ul class="yun_newedition_joblist" id="eduBgs">
                </ul>
            </div>
        </div>

        <div class="yun_newedition_resume_right">
            <div class=" noprint">
                <div class="yun_resume_cz " style="padding:0px;border:none; background:none">
                    <a href="" class="yun_resume_cz_xg">修改简历</a>
                    <input class="yun_resume_cz_bc yun_resume_cz_bth_xz fl " type="submit" name="submit"
                           value="保存到电脑 "/>
                    <div class="mt10">
                        <div class="yun_resume_cz_gz">如需手机上传或修改个人形象照，请关注微信进行操作</div>
                    </div>
                </div>
                <div class="yun_resume_czewm">
                    <div class="yun_resume_czewmpic"><img src="" width="150" height="150"></div>
                    <div class="yun_resume_cz_tit">扫一扫手机上也可以编辑简历了</div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="clear"></div>
<!-- 联系方式弹出框 -->
<div style="width:450px; display:none" id='link_style_div'>
    <div class="tcktouch_box">
        <div class="tcktouch_box_username">老谭</div>
        <div class="tcktouch_box_tip">联系我时请说是在千里马人才招聘系统上看到的</div>
        <div class="tcktouch_box_p">手机：<span class="tcktouch_box_p_sj">15982352915</span></div>
    </div>
</div>

<div class="hp_foot fl" th:insert="~{/commons/footer}"></div>
</body>
</html>
	